<?PHP
global $conf;
$today = date("Y-m-d");




if(!empty($content) &&  $conf->qm[0]!='community')
{

		$category->where['id']=$content['category'];
		$category->get_category();
		$category_data=current($category->data);

		$conf->style['masthead']=$content['title'];
		$home=false;
		$crumbs=$category_data['name']." > ".	$content['title'];
		$c_content->process_meta();
		$conf->meta['page_title']=$content['title'].' - '.$conf->a['site-name'];

		$content_serial=unserialize($content['serial']);

		$cat_content=new content;
		$cat_content->where['category']=$content['category'];
		$cat_content->get_content();
		$cat_content->process_images();
		$cat_content->get_metadata();
		
		$conf->style['background'].='background-image:url('.ap($content_serial["serial_style_background_image"]).');';
		$conf->style['background'].='background-color:#'.$content_serial["serial_style_background_color"].';';
		$custom_masthead='color:#'.$content_serial["serial_style_masthead_color"].';';
		
		$cat_data=$cat_content->data;
		$content_tag="content-".$content['id'];



		$share_twitter=urlencode($conf->meta['Description']);
		$share_google="http://www.google.com/reader/link?url=".$conf->canonical."&title=".urlencode($conf->meta['page_title'])."&snippet=".urlencode($conf->meta['Description']);
		$share_digg="http://digg.com/submit?url=".$conf->canonical."&title=".urlencode($conf->meta['page_title'])."&bodytext=".urlencode($conf->meta['Description'])."&topic=lifestyle";

		$share_twitter="http://twitter.com/home?status=from @pinoytuner ".urlencode($conf->meta['page_title'])." ".$conf->canonical;
		$share_facebook="http://www.facebook.com/sharer.php?u=".$conf->canonical."&t=".urlencode($conf->meta['page_title']);
}

if(!empty($content) &&  $conf->qm[0]=='article' || !empty($content) &&  $conf->qm[0]=='gallery')
{
		mp("grab this");
	$r_content=new content;
	$r_content->where['category']=$content['category'];
	$r_content->options['order'][0]='id';
	$r_content->options['order'][1]='desc';
	$r_content->get_content();
	mp("grab this");
	$a_category=new content_category;
	$a_category->where['id']=$content['category'];
	$a_category->get_category();
	$t_cd=current($a_category->data);
	$s_category=current($a_category->data);
	//get parent category
	$a_category->where['id']=$t_cd['parent'];
	$a_category->get_category();
	$category_data=current($a_category->data);
	
	$category_serial=unserialize($category_data['serial']);
	

	$conf->style['masthead']=$category_data['name'];
	if(!empty($category_data['image']))
	{
		$conf->style['masthead']='<img src="'.ap($category_data['image']).'"/>';
	}
	
	$conf->style['background'].='background-image:url('.ap($category_serial["serial_style_background_image"]).');';
	$conf->style['background'].='background-color:#'.$category_serial["serial_style_background_color"].';';
	$custom_masthead='color:#'.$category_serial["serial_style_masthead_color"].';';
	
	$related_articles=$r_content->data;
	
	

}
if(!empty($content) &&  $conf->qm[0]=='gallery')
{
	$image_gallery=new media();
	$image_gallery->where['content']=$content['id'];
	$image_gallery->get_gallery_images();
	
}
//select here which template or popout

if($conf->qm[0]=='community' && !empty($category_data['page']))
{
	
		$conf->page_render='assets/pages/'.$category_data["page"].'.php';
}
else if($conf->qm[0]=='community' && empty($category_data['page']))
{
		page_redirect($conf->absolute_path);
		$conf->page_render='admin/e/404.php';
}
else if($conf->qm[0]=='watch' && !empty($content['player_page']))
{
		$conf->page_render='assets/pages/'.$content["player_page"].'.php';
}
else if($conf->qm[0]=='watch' || $conf->qm[0]=='community')
{

	$conf->page_render='assets/pages/base.php';

}

?>
